<template>
	<view :class="currentTheme">
		<a-nabbar name="切换展会" />
		<view v-if="list.length" class="u-padding-32">
			<item-box padding="0">
				<view class="group-box">
					<v-radio :name="item.id" v-for="(item, index) in list" :key="index"  v-model="exhibitId">
						<view class="text-white-black-reversal u-font-32 u-padding-top-66 u-padding-bottom-66"  
						:class="{'u-border-bottom':index<list.length - 1}">{{item.name}}</view>
					</v-radio>
				</view>
			</item-box>
		</view>
		<empty v-else />
		<fixed-team btnText="确定"  v-if="list.length" @btnClick="change"></fixed-team>
	</view>
</template>

<script>
	import {getDetail,add} from '@/api/crud.js'
	import empty from '@/components/mescroll-uni/components/mescroll-empty.vue'
	import vRadio from '@/components/itemRadio/itemRadio.vue'
	export default {
		data() {
			return {
				exhibitId:'',
				apiModule:'shopApi',
				apiType:"user",
				list:[]
			};
		},
		components: {
			empty,vRadio
		},
		onLoad() {
			this.exhibitId = this.loginForm.exhibitId
			this.getDetail()
		},
		methods: {
			getDetail() {
				getDetail('',this.apiType,this.apiModule,'getActivityExhibits').then(res=>{
					this.list = res;
					if(!this.exhibitId){
						this.exhibitId = res[0].id
					}
				});
			},
			change(){
				add('',this.apiType,this.apiModule,'alterExhibit/'+this.exhibitId).then(res=>{
					this.routeBack('切换成功')
				})
			}
		},
	}
</script>
<style lang="scss" scoped>
.group-box{
	padding-left: 47rpx;
}
</style>
